package com.muchfish.reactor.api;

import reactor.core.publisher.Mono;
import reactor.util.context.Context;

public class ReactorContextExample {
    public static void main(String[] args) {
        Mono<String> mono = Mono.deferContextual(contextView ->
                Mono.just("Hello, " + contextView.get("user")));

        String result = mono.contextWrite(Context.of("user", "John")).block();
        System.out.println(result); // 输出: Hello, John
    }
}
